/*
 * timer.h
 *
 *  Created on: 2010-03-03
 *      Author: sikorskip
 */

#ifndef TIMER_H_
#define TIMER_H_

#include <inttypes.h>
#include "power/power.h"

struct timer {
	uint8_t id;
	uint8_t hour;
	uint8_t minute;
	uint8_t active:1;
	uint8_t allreadyTriggered:1;
	uint8_t mode:1;
	uint8_t powerId;
};

extern struct timer powerTimers[POWER_OUTPUT_COUNT * 2];
extern uint8_t powerStatus[POWER_OUTPUT_COUNT];

void setupTimers();

void readTimer(struct timer *timer);

void writeTimer(struct timer *timer);

void checkTimers();

void checkTimer(struct timer *timer, uint8_t minutes, uint8_t hours);

uint8_t clockGetHour();

uint8_t clockGetMinute();

uint8_t clockGetSecond();

#endif /* TIMER_H_ */
